home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASFILES.LZH / MESSAGE.BAS < prev    next >
BASIC Source File  |  1988-09-10  |  2KB  |  90 lines

  1. '$INCLUDE:'QBTOOLS.INC'
  2. '' DECLARE SUB Message (Text$(), textc%, Border%, Bf%, Bb%, Gf%, Gb%)
  3. '' '$INCLUDE: 'qbtools2.inc'
  4.  
  5.  
  6.  
  7. 'DIM Text$(11)
  8. 'Text$(1) = "You have reached THIS part of"
  9. 'Text$(2) = "the program because you are an idiot."
  10. 'Text$(3) = ""
  11. 'Text$(4) = "Please re-run it from the start."
  12. 'Text$(5) = "FOOL!"
  13. 'Text$(6) = ""
  14. 'Text$(7) = "Good Condition"
  15. 'Text$(8) = "Try this"
  16. 'Text$(9) = "Here is another one for you to test and check around"
  17. 'Text$(10) = ""
  18. 'Text$(11) = "This is a banana Item"
  19.  
  20. 'FOR j% = 1 TO 7
  21. '   Message Text$(), 11, j%, 7, 0, 0, 7
  22. 'NEXT j%
  23.  
  24. SUB Message (Text$(), textc%, Border%, Bf%, Bb%, Gf%, Gb%)
  25.  
  26.     '  Text1$   -  Text to display
  27.     '  Textc%   -  Text ITEMS to display
  28.     '  Border%  -  Border type
  29.     '  Bf%      -  Border foreground color
  30.     '  Bb%      -  Border backgroynd color
  31.     '  Gf%      -  Global foreground
  32.     '  Gb%      -  Global background
  33.  
  34.     '$DYNAMIC
  35.  
  36.     REDIM Saver%(2000)
  37.  
  38.     MaxWidth% = 0
  39.     El% = UBOUND(Text$, 1)
  40.   
  41.     IF textc% > El% THEN
  42.         EXIT SUB
  43.     END IF
  44.  
  45.     FOR j% = 1 TO textc%
  46.         trim Text$(j%)
  47.         MaxWidth% = Maximum%(MaxWidth%, LEN(Text$(j%)))
  48.     NEXT j%
  49.  
  50.     MaxWidth% = MaxWidth% + 4     '  Plus borders
  51.     MaxHeight% = textc% + 4       '  Plus Borders
  52.  
  53.     IF MaxWidth% > 80 THEN
  54.         EXIT SUB                   '  TOO Wide
  55.     END IF
  56.  
  57.     IF MaxHeight% > 24 THEN       '  TOO High
  58.         EXIT SUB
  59.     END IF
  60.  
  61.     TopRow% = 24 - MaxHeight%     '  Top row
  62.     TopRow% = TopRow% / 2
  63.  
  64.     LeftCol% = 80 - MaxWidth%     '  Left column
  65.     LeftCol% = LeftCol% / 2
  66.  
  67.     SaveScreen Saver%(1)          '  Save the screen
  68.  
  69.     DrawBox TopRow%, LeftCol%, MaxWidth%, MaxHeight%, Border%, Bf%, Bb%, 1, Gf%, Gb%
  70.  
  71.     Attr% = Attributes%(Gf%, Gb%, 0, 0)
  72.  
  73.     FOR j% = 1 TO textc%
  74.         Diff% = (MaxWidth% - LEN(Text$(j%)))
  75.         IF Diff% THEN
  76.             Diff% = Diff% / 2
  77.         END IF
  78.         TextToPrint$ = Text$(j%)
  79.         Row% = j% + TopRow% + 1
  80.         Col% = LeftCol% + Diff%
  81.         ColorPrint TextToPrint$, Row%, Col%, Attr%
  82.     NEXT j%
  83.  
  84.     Pause
  85.  
  86.     RestoreScreen Saver%(1)
  87.  
  88. END SUB
  89.  
  90.